<!-- 
*   @Description:
*   @Author:lxy
*   @Date:2023-03-23 10:23
-->
<template>
  <div>
    <div id="he-plugin-standard" ref="divRef"></div>
  </div>
</template>

<script>
export default {
  name: "standard",
  mounted() {
    window.WIDGET = {
      CONFIG: {
        layout: "2",
        width: "100%",
        height: "350",
        background: "1",
        dataColor: "FFFFFF",
        language: "zh",
        borderRadius: "10",
        // city: "CN101120505",
        key: "1bb3b8a6169e46d58ef023d96b4e84ab",
      },
    };
    (function (d) {
      var c = d.createElement("link");
      c.rel = "stylesheet";
      c.href =
        "https://widget.qweather.net/standard/static/css/he-standard.css?v=1.4.0";
      var s = d.createElement("script");
      s.src =
        "https://widget.qweather.net/standard/static/js/he-standard.js?v=1.4.0";
      var sn = d.getElementsByTagName("script")[0];
      sn.parentNode.insertBefore(c, sn);
      sn.parentNode.insertBefore(s, sn);
      s.onload = () => {
        //自动宽度
        setTimeout(() => {
          document.getElementById("he-plugin-standard").style.width = "100%";
        }, 100);
      };
    })(document);
    this.showTiltle();
  },
  data() {
    return {};
  },
  methods: {
    showTiltle() {
      console.log(this.$refs.divRef);
      window.addEventListener("load", function () {
        let refresh = document.getElementsByClassName("wv-lt-refresh");
        refresh[0].style.display = "none";
      });
    },
  },
};
</script>

<style scoped></style>
